using System;
using System.Text;
using System.Collections.Generic;
using iBeauty.BusinessObjects;
using iBeauty.DAL;

namespace iBeauty.BLL
{
	public class BillBLL
	{
		private BillDAO _BillDAO;

		public BillDAO BillDAO
		{
			get { return _BillDAO; }
			set { _BillDAO = value; }
		}

		public BillBLL()
		{
			BillDAO = new BillDAO();
		}
		public List<Bill> GetBills()
		{
			try
			{
				return BillDAO.GetBills();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public Bill GetBill(string ID)
		{
			try
			{
				return BillDAO.GetBill(ID);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public int AddBill(Bill oBill)
		{
			try
			{
				return BillDAO.AddBill(oBill);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int AddBill(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string BillCode,DateTime? BillDate,string SupplierCode,string SupplierName,string ShopCode,string ShopName,string StaffCode,string StaffName,string BillType,string PaymentType,string QuantityTotal,Double? TaxRate,Double? MoneyTotalNoTax,Double? TaxTotal,Double? MoneyTotal,Double? PayTotal,Double? DebtTotal,int? AccountId,string Note)
		{
			try
			{
				return BillDAO.AddBill(ID,CreateDate,ModifiedDate,TimeStamp,BillCode,BillDate,SupplierCode,SupplierName,ShopCode,ShopName,StaffCode,StaffName,BillType,PaymentType,QuantityTotal,TaxRate,MoneyTotalNoTax,TaxTotal,MoneyTotal,PayTotal,DebtTotal,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateBill(Bill oBill)
		{
			try
			{
				return BillDAO.UpdateBill(oBill);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateBill(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string BillCode,DateTime? BillDate,string SupplierCode,string SupplierName,string ShopCode,string ShopName,string StaffCode,string StaffName,string BillType,string PaymentType,string QuantityTotal,Double? TaxRate,Double? MoneyTotalNoTax,Double? TaxTotal,Double? MoneyTotal,Double? PayTotal,Double? DebtTotal,int? AccountId,string Note)
		{
			try
			{
				return BillDAO.UpdateBill(ID,CreateDate,ModifiedDate,TimeStamp,BillCode,BillDate,SupplierCode,SupplierName,ShopCode,ShopName,StaffCode,StaffName,BillType,PaymentType,QuantityTotal,TaxRate,MoneyTotalNoTax,TaxTotal,MoneyTotal,PayTotal,DebtTotal,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveBill(Bill oBill)
		{
			try
			{
				return BillDAO.RemoveBill(oBill);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveBill(string ID)
		{
			try
			{
				return BillDAO.RemoveBill(ID);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<Bill> DeserializeBills(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<Bill>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializeBills(string Path, List<Bill> Bills)
		{
			try
			{
				GenericXmlSerializer<List<Bill>>.Serialize(Bills, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
